home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cppdll
/
readme.doc
< prev
next >
Wrap
Text File
|
1990-03-07
|
2KB
|
30 lines
Enclosed you'll find a simple example of the C++ class implemented as
a DLL. What makes it possible, is the fact that a default C++ linkage
is identical to PASCAL. If you use compact/large model it becomes FAR
PASCAL (just what the WINDOWS export function needs). To put your class
(or a cluster of them), compile them as any other class, and then create
*.def file. All public methods must be exported, you can do that by listing
their mangled names in an EXPORTS section of the *.def file. Mangled names
can be found in a *.map file. You don't even have to read them, just cut and
paste them into *.def.
My approach seems to work well ( I haven't really tested it yet), but there
are two gotcha's you have to remember.
1. Only the methods with a fixed number of arguments can be exported
2. It works only in a LARGE model.
The second requirement is due to the fact that size of 'this' pointer is
based on the compilation model used. Since DLLs have own data segments an
object has to be referenced using a far pointer. From what I've heard far
classes will be implemented in the next release along with pointers to
members (right Walter ?).
I am also enclosing two programming utilities (implemented as DLLs), they
encapsulate color and font selection mechanism. Feel free to use, copy and
distribute them. If you find them useful, I would appreciate your
contribution of $25. See an About... box in the dialog box for details.
I will appreciate any comments, suggestions, improvements etc. Please post
a message to Andy Mazur.